using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Mark.Models;

/// <summary>
/// 文件信息实体
/// </summary>
public class FileInfo : BaseEntity
{
    [Required]
    [MaxLength(500)]
    public string Name { get; set; } = string.Empty;
    
    [Required]
    [MaxLength(1000)]
    public string Path { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件大小（字节）
    /// </summary>
    public long Size { get; set; }
    
    /// <summary>
    /// MIME类型
    /// </summary>
    [Required]
    [MaxLength(100)]
    public string MimeType { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件扩展名
    /// </summary>
    [MaxLength(20)]
    public string? Extension { get; set; }
    
    /// <summary>
    /// 文件哈希值
    /// </summary>
    [MaxLength(100)]
    public string? Hash { get; set; }
    
    /// <summary>
    /// 文件内容（小文件可以直接存储）
    /// </summary>
    public string? Content { get; set; }
    
    /// <summary>
    /// 文件元数据 (JSON)
    /// </summary>
    public string? Metadata { get; set; }
    
    /// <summary>
    /// 文件状态：uploaded, processing, processed, error
    /// </summary>
    [MaxLength(20)]
    public string Status { get; set; } = "uploaded";
    
    /// <summary>
    /// 文件用途：chat, knowledge_base, avatar, etc.
    /// </summary>
    [MaxLength(50)]
    public string Purpose { get; set; } = "chat";
    
    /// <summary>
    /// 最后修改时间
    /// </summary>
    public DateTime LastModified { get; set; }
    
    // 外键
    [Required]
    public string UserId { get; set; } = string.Empty;
    
    // 导航属性
    [ForeignKey("UserId")]
    public virtual User User { get; set; } = null!;
    
    public virtual ICollection<MessageFile> MessageFiles { get; set; } = new List<MessageFile>();
} 